-
Notifications
You must be signed in to change notification settings - Fork 14.5k
SPARC: Start moving runtime libcall config to tablegen #147672
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
arsenm
merged 1 commit into
main
from
users/arsenm/sparc/start-moving-runtime-libcalls-tablegen
Jul 14, 2025
Merged
SPARC: Start moving runtime libcall config to tablegen #147672
arsenm
merged 1 commit into
main
from
users/arsenm/sparc/start-moving-runtime-libcalls-tablegen
Jul 14, 2025
+17
−13
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This stack of pull requests is managed by Graphite. Learn more about stacking. |
@llvm/pr-subscribers-llvm-ir @llvm/pr-subscribers-backend-sparc Author: Matt Arsenault (arsenm) ChangesFull diff: https://github.com/llvm/llvm-project/pull/147672.diff 2 Files Affected:
diff --git a/llvm/include/llvm/IR/RuntimeLibcalls.td b/llvm/include/llvm/IR/RuntimeLibcalls.td
index 403d98912653d..1554a6b7697e2 100644
--- a/llvm/include/llvm/IR/RuntimeLibcalls.td
+++ b/llvm/include/llvm/IR/RuntimeLibcalls.td
@@ -1828,6 +1828,22 @@ def _Q_qtoull : RuntimeLibcallImpl<FPTOUINT_F128_I64>;
def _Q_lltoq : RuntimeLibcallImpl<SINTTOFP_I64_F128>;
def _Q_ulltoq : RuntimeLibcallImpl<UINTTOFP_I64_F128>;
+def isSPARC : RuntimeLibcallPredicate<"TT.isSPARC()">;
+def isSPARC32 : RuntimeLibcallPredicate<"TT.isSPARC32()">;
+def isSPARC64 : RuntimeLibcallPredicate<"TT.isSPARC64()">;
+
+defvar SPARC64_MulDivCalls = [
+ __mulsi3, __divsi3, __modsi3, __udivsi3, __umodsi3
+];
+
+def SPARCSystemLibrary
+ : SystemRuntimeLibrary<isSPARC,
+ (add (sub DefaultLibcallImpls32, SPARC64_MulDivCalls),
+ sparc_umul, sparc_div, sparc_udiv, sparc_rem, sparc_urem,
+ LibcallImpls<(add _Q_qtoll, _Q_qtoull, _Q_lltoq, _Q_ulltoq), isSPARC32>,
+ LibcallImpls<(add SPARC64_MulDivCalls, Int128RTLibcalls), isSPARC64>)
+>;
+
//===----------------------------------------------------------------------===//
// Windows Runtime Libcalls
//===----------------------------------------------------------------------===//
diff --git a/llvm/lib/Target/Sparc/SparcISelLowering.cpp b/llvm/lib/Target/Sparc/SparcISelLowering.cpp
index 9487234561824..9b434d87c2676 100644
--- a/llvm/lib/Target/Sparc/SparcISelLowering.cpp
+++ b/llvm/lib/Target/Sparc/SparcISelLowering.cpp
@@ -1824,12 +1824,6 @@ SparcTargetLowering::SparcTargetLowering(const TargetMachine &TM,
setOperationAction(ISD::MULHS, MVT::i32, Expand);
setOperationAction(ISD::MUL, MVT::i32, Expand);
- setLibcallImpl(RTLIB::MUL_I32, RTLIB::sparc_umul);
- setLibcallImpl(RTLIB::SDIV_I32, RTLIB::sparc_div);
- setLibcallImpl(RTLIB::UDIV_I32, RTLIB::sparc_udiv);
- setLibcallImpl(RTLIB::SREM_I32, RTLIB::sparc_rem);
- setLibcallImpl(RTLIB::UREM_I32, RTLIB::sparc_urem);
-
if (Subtarget->useSoftMulDiv()) {
// .umul works for both signed and unsigned
setOperationAction(ISD::SMUL_LOHI, MVT::i32, Expand);
@@ -1879,13 +1873,6 @@ SparcTargetLowering::SparcTargetLowering(const TargetMachine &TM,
setOperationAction(ISD::STORE, MVT::f128, Custom);
}
- if (!Subtarget->is64Bit()) {
- setLibcallImpl(RTLIB::FPTOSINT_F128_I64, RTLIB::_Q_qtoll);
- setLibcallImpl(RTLIB::FPTOUINT_F128_I64, RTLIB::_Q_qtoull);
- setLibcallImpl(RTLIB::SINTTOFP_I64_F128, RTLIB::_Q_lltoq);
- setLibcallImpl(RTLIB::UINTTOFP_I64_F128, RTLIB::_Q_ulltoq);
- }
-
if (Subtarget->hasHardQuad()) {
setOperationAction(ISD::FADD, MVT::f128, Legal);
setOperationAction(ISD::FSUB, MVT::f128, Legal);
|
38bfe36
to
8dfe2c8
Compare
RKSimon
approved these changes
Jul 14, 2025
Merge activity
|
1a0e627
to
345df81
Compare
Base automatically changed from
users/arsenm/sparc/remove-conditions-setLibcallImpl
to
main
July 14, 2025 09:11
8dfe2c8
to
29bb6c9
Compare
29bb6c9
to
f3cf776
Compare
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
No description provided.